<html>
<head>
    <style>
        ::-webkit-scrollbar {
            width: 0px;
            height: 0px;
        }
    </style>
    <script src="../../resources/js-test.js"></script>
    <script>
      window.enablePixelTesting = true;

      if (window.testRunner)
        testRunner.waitUntilDone();

      // Layout for the iframe will be scaled down to a quarter.
      // It appears this bug will only manifest itself if layout for the
      // iframe has not yet been computed. If we've already laid out
      // the iframe, then CSSStyleSelector::styleForDocument does not appear
      // to get called for the iframe.
      scalePage(0.5);

      function scalePage(scaleFactor) {
          if (window.internals) {
            internals.setPageScaleFactorLimits(0.5, 4);
            internals.setPageScaleFactor(scaleFactor);
          }
      }

      function test() {
          // Curiously, the document style for the iframe does not
          // appear to be recalculated after this
          scalePage(1.0);
          document.body.offsetWidth;
          if (window.testRunner)
            testRunner.notifyDone();
      }
    </script>
    <script src="../../resources/js-test.js"></script>
</head>
<body onload="test();">
  <iframe id="frame" src="resources/iframe-content-scaling-bug-iframe.html" style="position: absolute; left: 0px; top: 0px; border: none; width: 300px; height: 300px;"></iframe>
  <div id="rightbox" style="position: absolute; left: 300px; top: 0px; width: 300px; height: 300px; background-color: green;"></div>
</body>
</html>
